﻿using System.Modules.SharePoint.Constants;

namespace System.Modules.SharePoint.Contracts.DTO
{
    /// <summary>
    /// SP Query AND condition
    /// </summary>
    public class SPQueryAnd : SPQueryJointCondition
    {
        #region Override
        /// <summary>
        /// Overrides To String
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return string.Format(SPQueryTemplates.AND, FirstCondition, SecondCondition);
        }
        #endregion

        #region Implicit Operators
        /// <summary>
        /// Implicit conversion operator to string
        /// </summary>
        /// <param name="value">The SP Query Value</param>
        /// <returns>A string representation of the object</returns>
        public static implicit operator string(SPQueryAnd value)
        {
            return value == null ? string.Empty : value.ToString();
        }
        #endregion
    }
}
